Optimal. Leaf size=528 \[ -\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}+\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}-\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}+\frac {2 i f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )}{a d^2}+\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 f^2 \text {Li}_3\left (-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \text {Li}_3\left (e^{i (c+d x)}\right )}{a d^3}+\frac {2 i b f^2 \text {Li}_3\left (\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^3}-\frac {2 i b f^2 \text {Li}_3\left (\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^3} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.63, antiderivative size = 528, normalized size of antiderivative = 1.00, number of steps
used = 18, number of rules used = 8, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {4631, 4268,
2611, 2320, 6724, 3404, 2296, 2221} \begin {gather*} \frac {2 i b f^2 \text {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a d^3 \sqrt {a^2-b^2}}-\frac {2 i b f^2 \text {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{a d^3 \sqrt {a^2-b^2}}+\frac {2 b f (e+f x) \text {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a d^2 \sqrt {a^2-b^2}}-\frac {2 b f (e+f x) \text {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{a d^2 \sqrt {a^2-b^2}}-\frac {2 f^2 \text {PolyLog}\left (3,-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \text {PolyLog}\left (3,e^{i (c+d x)}\right )}{a d^3}+\frac {2 i f (e+f x) \text {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}+\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a d \sqrt {a^2-b^2}}-\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{a d \sqrt {a^2-b^2}}-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2221
Rule 2296
Rule 2320
Rule 2611
Rule 3404
Rule 4268
Rule 4631
Rule 6724
Rubi steps
\begin {align*} \int \frac {(e+f x)^2 \csc (c+d x)}{a+b \sin (c+d x)} \, dx &=\frac {\int (e+f x)^2 \csc (c+d x) \, dx}{a}-\frac {b \int \frac {(e+f x)^2}{a+b \sin (c+d x)} \, dx}{a}\\ &=-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}-\frac {(2 b) \int \frac {e^{i (c+d x)} (e+f x)^2}{i b+2 a e^{i (c+d x)}-i b e^{2 i (c+d x)}} \, dx}{a}-\frac {(2 f) \int (e+f x) \log \left (1-e^{i (c+d x)}\right ) \, dx}{a d}+\frac {(2 f) \int (e+f x) \log \left (1+e^{i (c+d x)}\right ) \, dx}{a d}\\ &=-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}+\frac {2 i f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )}{a d^2}+\frac {\left (2 i b^2\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{2 a-2 \sqrt {a^2-b^2}-2 i b e^{i (c+d x)}} \, dx}{a \sqrt {a^2-b^2}}-\frac {\left (2 i b^2\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{2 a+2 \sqrt {a^2-b^2}-2 i b e^{i (c+d x)}} \, dx}{a \sqrt {a^2-b^2}}-\frac {\left (2 i f^2\right ) \int \text {Li}_2\left (-e^{i (c+d x)}\right ) \, dx}{a d^2}+\frac {\left (2 i f^2\right ) \int \text {Li}_2\left (e^{i (c+d x)}\right ) \, dx}{a d^2}\\ &=-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}+\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}-\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}+\frac {2 i f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )}{a d^2}-\frac {(2 i b f) \int (e+f x) \log \left (1-\frac {2 i b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{a \sqrt {a^2-b^2} d}+\frac {(2 i b f) \int (e+f x) \log \left (1-\frac {2 i b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{a \sqrt {a^2-b^2} d}-\frac {\left (2 f^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2(-x)}{x} \, dx,x,e^{i (c+d x)}\right )}{a d^3}+\frac {\left (2 f^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2(x)}{x} \, dx,x,e^{i (c+d x)}\right )}{a d^3}\\ &=-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}+\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}-\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}+\frac {2 i f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )}{a d^2}+\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 f^2 \text {Li}_3\left (-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \text {Li}_3\left (e^{i (c+d x)}\right )}{a d^3}-\frac {\left (2 b f^2\right ) \int \text {Li}_2\left (\frac {2 i b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{a \sqrt {a^2-b^2} d^2}+\frac {\left (2 b f^2\right ) \int \text {Li}_2\left (\frac {2 i b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{a \sqrt {a^2-b^2} d^2}\\ &=-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}+\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}-\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}+\frac {2 i f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )}{a d^2}+\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 f^2 \text {Li}_3\left (-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \text {Li}_3\left (e^{i (c+d x)}\right )}{a d^3}+\frac {\left (2 i b f^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2\left (\frac {i b x}{a-\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{a \sqrt {a^2-b^2} d^3}-\frac {\left (2 i b f^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2\left (\frac {i b x}{a+\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{a \sqrt {a^2-b^2} d^3}\\ &=-\frac {2 (e+f x)^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )}{a d}+\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}-\frac {i b (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d}+\frac {2 i f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )}{a d^2}+\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 b f (e+f x) \text {Li}_2\left (\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^2}-\frac {2 f^2 \text {Li}_3\left (-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \text {Li}_3\left (e^{i (c+d x)}\right )}{a d^3}+\frac {2 i b f^2 \text {Li}_3\left (\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^3}-\frac {2 i b f^2 \text {Li}_3\left (\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2} d^3}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.49, size = 982, normalized size = 1.86 \begin {gather*} \frac {-2 d^2 e^2 \tanh ^{-1}\left (e^{i (c+d x)}\right )+2 d^2 e f x \log \left (1-e^{i (c+d x)}\right )+d^2 f^2 x^2 \log \left (1-e^{i (c+d x)}\right )-2 d^2 e f x \log \left (1+e^{i (c+d x)}\right )-d^2 f^2 x^2 \log \left (1+e^{i (c+d x)}\right )+2 i d f (e+f x) \text {Li}_2\left (-e^{i (c+d x)}\right )-2 i d f (e+f x) \text {Li}_2\left (e^{i (c+d x)}\right )-2 f^2 \text {Li}_3\left (-e^{i (c+d x)}\right )+2 f^2 \text {Li}_3\left (e^{i (c+d x)}\right )+\frac {b \left (2 \sqrt {a^2-b^2} d e^{i c} f (e+f x) \text {Li}_2\left (\frac {i b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )+i \left (2 d^2 e^2 \sqrt {\left (a^2-b^2\right ) e^{2 i c}} \tanh ^{-1}\left (\frac {-a+i b e^{i (c+d x)}}{\sqrt {a^2-b^2}}\right )+2 \sqrt {a^2-b^2} d^2 e e^{i c} f x \log \left (1-\frac {i b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )+\sqrt {a^2-b^2} d^2 e^{i c} f^2 x^2 \log \left (1-\frac {i b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )-2 \sqrt {a^2-b^2} d^2 e e^{i c} f x \log \left (1-\frac {i b e^{i (2 c+d x)}}{a e^{i c}+\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )-\sqrt {a^2-b^2} d^2 e^{i c} f^2 x^2 \log \left (1-\frac {i b e^{i (2 c+d x)}}{a e^{i c}+\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )+2 i \sqrt {a^2-b^2} d e^{i c} f (e+f x) \text {Li}_2\left (\frac {i b e^{i (2 c+d x)}}{a e^{i c}+\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )+2 \sqrt {a^2-b^2} e^{i c} f^2 \text {Li}_3\left (\frac {i b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )-2 \sqrt {a^2-b^2} e^{i c} f^2 \text {Li}_3\left (\frac {i b e^{i (2 c+d x)}}{a e^{i c}+\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )\right )\right )}{\sqrt {a^2-b^2} \sqrt {\left (a^2-b^2\right ) e^{2 i c}}}}{a d^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.08, size = 0, normalized size = 0.00 \[\int \frac {\left (f x +e \right )^{2} \csc \left (d x +c \right )}{a +b \sin \left (d x +c \right )}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 2426 vs. \(2 (461) = 922\).
time = 0.61, size = 2426, normalized size = 4.59 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (e + f x\right )^{2} \csc {\left (c + d x \right )}}{a + b \sin {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F(-1)]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \text {Hanged} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________